package com.erik.ipmonitor.service.impl;

import com.erik.ipmonitor.model.po.IpRequestLog;
import com.erik.ipmonitor.repository.IpRequestLogRepository;
import com.erik.ipmonitor.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * IndexServiceImpl
 *
 * @author : erik.zhou
 * @date : 2025/07/09/16:31
 * @description :
 */
@Service
public class IndexServiceImpl implements IndexService {

    @Autowired
    private IpRequestLogRepository ipRequestLogRepository;

    @Override
    public void saveIp(String clientIp, String finger) {
        IpRequestLog ipRequestLog = new IpRequestLog();
        ipRequestLog.setClientIp(clientIp);
        ipRequestLog.setFinger(finger);
        ipRequestLog.setIp(clientIp);
        ipRequestLog.setTimestamp(LocalDateTime.now());
        ipRequestLogRepository.save(ipRequestLog);
    }
}
